/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TableModel;

import Entities.Kendaraan;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Tea-Nose
 */
public class Kendaraan_List_TableModel extends AbstractTableModel{
 private List<Kendaraan> kendaraans = new ArrayList<Kendaraan>();

    public Kendaraan_List_TableModel(List<Kendaraan> kendaraans) {
        this.kendaraans = kendaraans;
    }
    public int getRowCount() {
        return kendaraans.size();
    }

    public int getColumnCount() {
        return 7;
    }

    
    public Object getValueAt(int rowIndex, int columnIndex) {
        Kendaraan kendaraan = kendaraans.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return kendaraan.getNo_polisi();
            case 1:
                return kendaraan.getMerk_kendaraan();
            case 2:
                return kendaraan.getTipe_kendaraan();
            case 3:
                return kendaraan.getWarna_kendaraan();
            case 4:
                return kendaraan.getSpesifikasi_kendaraan();
            case 5:
                return kendaraan.getStatus_kendaraan();
            case 6:
                return kendaraan.getHarga_Sewa_Per_Hari();
            default:
                return "";
        }
    }

    @Override
     public String getColumnName(int coloumn) {
        switch (coloumn) {
            case 0:
                return "No Polisi";
            case 1:
                return "Merk";
            case 2:
                return "Tipe";
            case 3:
                return "Warna";
            case 4:
                return "Spesifikasi";
            case 5:
                return "Status Kend.";
            case 6:
                return "Harga Sewa";
            default:
                return "";
        }
    }
}
